package com.jingdianjichi.oss.config;


import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*
 * minioconfig
 * */
@Configuration
public class MinioConfig {

    /*
     * minio的url
     * */
    @Value("${minio.url}")
    private String url;

    /*
     * minio的accessKey
     * */
    @Value("${minio.accessKey}")
    private String accessKey;

    /*
     * minio的secretKey
     * */
    @Value("${minio.secretKey}")
    private String secretKey;

    /*
    * 构造minioClient
    * */
    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
    }
}
